/*
using MyGeneration/Template/NHibernate (c) by Sharp 1.4
based on OHM (alvy77@hotmail.com)
*/
using System;
using System.Collections;
using System.Collections.Generic;

namespace DomainModel
{

	/// <summary>
	/// IDirectoryList interface for NHibernate mapped table 'DirectoryList'.
	/// </summary>
	public interface IDirectoryList
	{
		#region Public Properties
		
		int dl_id
		{
			get ;
			set ;
			  
		}
		
		int dl_uid
		{
			get ;
			set ;
			  
		}
		
		string dl_name
		{
			get ;
			set ;
			  
		}
		
		DateTime dl_time
		{
			get ;
			set ;
			  
		}
		
		bool IsDeleted { get; set; }
		bool IsChanged { get; set; }
		
		#endregion 
	}

	/// <summary>
	/// DirectoryList object for NHibernate mapped table 'DirectoryList'.
	/// </summary>
	[Serializable]
	public class DirectoryList : ICloneable,IDirectoryList
	{
		#region Member Variables

		protected int _dl_id;
		protected int _dl_uid;
		protected string _dl_name;
		protected DateTime _dl_time;
		protected bool _bIsDeleted;
		protected bool _bIsChanged;
		#endregion
		
		#region Constructors
		public DirectoryList() {}
		
		public DirectoryList(int pdluid, string pdlname, DateTime pdltime)
		{
			this._dl_uid = pdluid; 
			this._dl_name = pdlname; 
			this._dl_time = pdltime; 
		}
		
		public DirectoryList(int pdluid, string pdlname)
		{
			this._dl_uid = pdluid; 
			this._dl_name = pdlname; 
		}
		
		public DirectoryList(int pdlid)
		{
			this._dl_id = pdlid; 
		}
		
		#endregion
		
		#region Public Properties
		
		public virtual int dl_id
		{
			get { return _dl_id; }
			set { _bIsChanged |= (_dl_id != value); _dl_id = value; }
			
		}
		
		public virtual int dl_uid
		{
			get { return _dl_uid; }
			set { _bIsChanged |= (_dl_uid != value); _dl_uid = value; }
			
		}
		
		public virtual string dl_name
		{
			get { return _dl_name; }
			set 
			{
			  if (value != null && value.Length > 50)
			    throw new ArgumentOutOfRangeException("dl_name", "dl_name value, cannot contain more than 50 characters");
			  _bIsChanged |= (_dl_name != value); 
			  _dl_name = value; 
			}
			
		}
		
		public virtual DateTime dl_time
		{
			get { return _dl_time; }
			set { _bIsChanged |= (_dl_time != value); _dl_time = value; }
			
		}
		

		public virtual bool IsDeleted
		{
			get
			{
				return _bIsDeleted;
			}
			set
			{
				_bIsDeleted = value;
			}
		}
		
		public virtual bool IsChanged
		{
			get
			{
				return _bIsChanged;
			}
			set
			{
				_bIsChanged = value;
			}
		}
		
		#endregion 
		
		#region Equals And HashCode Overrides
		/// <summary>
		/// local implementation of Equals based on unique value members
		/// </summary>
		public override bool Equals( object obj )
		{
			if( this == obj ) return true;
			DirectoryList castObj = null;
			try
			{
				castObj = (DirectoryList)obj;
			} catch(Exception) { return false; } 
			return ( castObj != null ) &&
				( this._dl_id == castObj.dl_id );
		}
		/// <summary>
		/// local implementation of GetHashCode based on unique value members
		/// </summary>
		public override int GetHashCode()
		{
		  
			
			int hash = 57; 
			hash = 27 * hash * _dl_id.GetHashCode();
			return hash; 
		}
		#endregion
		
		#region ICloneable methods
		
		public virtual object Clone()
		{
			return this.MemberwiseClone();
		}
		
		#endregion
	}
	
	#region Custom ICollection interface for DirectoryList 

	
	public interface IDirectoryListCollection : ICollection
	{
		DirectoryList this[int index]{	get; set; }
		void Add(DirectoryList pDirectoryList);
		void Clear();
	}
	
	[Serializable]
	public class DirectoryListCollection : IDirectoryListCollection
	{
		private IList<DirectoryList> _arrayInternal;

		public DirectoryListCollection()
		{
			_arrayInternal = new List<DirectoryList>();
		}
		
		public DirectoryListCollection( IList<DirectoryList> pSource )
		{
			_arrayInternal = pSource;
			if(_arrayInternal == null)
			{
				_arrayInternal = new List<DirectoryList>();
			}
		}

		public DirectoryList this[int index]
		{
			get
			{
				return _arrayInternal[index];
			}
			set
			{
				_arrayInternal[index] = value;
			}
		}

		public int Count { get { return _arrayInternal.Count; } }
		public bool IsSynchronized { get { return false; } }
		public object SyncRoot { get { return _arrayInternal; } }
		public void CopyTo(Array array, int index){ _arrayInternal.CopyTo((DirectoryList[])array, index); }
		public IEnumerator GetEnumerator() { return _arrayInternal.GetEnumerator(); }
		public void Add(DirectoryList pDirectoryList) { _arrayInternal.Add(pDirectoryList); }
		public void Clear() { _arrayInternal.Clear(); }
		public IList<DirectoryList> GetList() { return _arrayInternal; }
	 }
	
	#endregion
}
